package com.example.tilitili.controller;


import com.example.tilitili.pojo.User;
import com.example.tilitili.rabbitMQ.MQSender;
import com.example.tilitili.vo.RespBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author chenyu
 * @since 2022-01-12
 */
@Controller
@RequestMapping("/user")
public class UserController {

    @Autowired
    private MQSender mqSender;

/*
    */
/*用于测试rabbitMQ发送消息*//*

    @RequestMapping("MQ")
    @ResponseBody
    public void MQ() {
        mqSender.send("Hello world!");
    }

    */
/**
     * 测试发送RabbitMQ消息(fanout模式)
     *//*

    @RequestMapping("MQ/fanout")
    @ResponseBody
    public void mq() {
        mqSender.send("Hello world!");
    }

    */
/**
     * 测试发送RabbitMQ消息(direct模式)
     *//*

    @RequestMapping("MQ/direct01")
    @ResponseBody
    public void mq01() {
        mqSender.send01("Hello,Red");
    }

    */
/**
     * 测试发送RabbitMQ消息(direct模式)
     *//*

    @RequestMapping("MQ/direct02")
    @ResponseBody
    public void mq02() {
        mqSender.send02("Hello,Green");
    }

    */
/**
     * 测试发送RabbitMQ消息(topic模式)
     *//*

    @RequestMapping("MQ/topic01")
    @ResponseBody
    public void mq03() {
        mqSender.send03("Hello,Red");
    }

    */
/**
     * 测试发送RabbitMQ消息(topic模式)
     *//*

    @RequestMapping("MQ/topic02")
    @ResponseBody
    public void mq04() {
        mqSender.send04("Hello,Green");
    }
*/
    /*用户信息，用于测试*/
    @RequestMapping("/info")
    @ResponseBody
    public RespBean info(User user) {
        return RespBean.success(user);
    }
}
